Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body onunload="myFunction()"> <h1>Welcome to my Home Page</h1> <p>Close this window or press F5 to reload the page.</p> <p><strong>Note:</strong> Due to different browser settings, this event may not always work as expected.</p> <script> function myFunction() { alert("Thank you for visiting W3Schools!"); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onunload by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:29:40 GMT --> </html>
Result:
Try it Yourself - © w3schools.com